import request from './../utils/request'

const baseUrl = '/aaa'

/**
 * 根据模块生成增删查改
 * @param {} url 模块的地址
 * @returns 
 */
export const useApi = (url) => {

  return {
    // 获取数据
    getData(data) {
      return request.post(`/aaa${url}/page`, data)
    },
    addData(data) {
      return request.post(`/aaa${url}/add`, data)
    },
    updateData(data) {
      return request.post(`/aaa${url}/update`, data)
    },

    delData(ids) {
      return request.post(`/aaa${url}/delete`, { ids })
    },

    getDataInfo(id) {
      return request.get(`/aaa${url}/info?id=${id}`)
    }
  }
}